package com.example.user.controller.v1;

import com.example.model.user.pojo.UserDO;
import com.example.user.service.UserService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 用户 前端控制层
 *
 * @author Lv
 * @date 2023/10/02
 */
@Api(tags = "用户")
@RestController
@RequestMapping("/api/v1/user")
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 获取详情
     *
     * @param id 用户id
     * @return
     */
    @GetMapping("/{id}")
    public UserDO getById(@PathVariable("id") Long id) {
        return userService.getById(id);
    }

    /**
     * 测试order服务RPC接口
     *
     * @return
     */
    @PostMapping("/test_rpc")
    public String testOrderRpc() {
        return userService.testOrderRpc();
    }
}

